package ru.alperez.gpsdub.widget;

import ru.alperez.gpsdub.R;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.TabHost;
import android.widget.TextView;


public class CustomTabHost extends TabHost{
	public CustomTabHost(Context context) {
		super(context);
	}
	
	public CustomTabHost(Context context, AttributeSet attrs) {
		super(context, attrs);
	}
	
	public void addTab(int labelResourceId, String tag, int contentResourceId) {
		TabHost.TabSpec spec = this.newTabSpec(tag);	
		
		
		TextView tabIndicator = ((TextView)(LayoutInflater.from( this.getContext() ).inflate(R.layout.tab_indicator, this.getTabWidget(), false)));
		tabIndicator.setText((labelResourceId>=0) ? getResources().getString(labelResourceId) : "");
		spec.setIndicator(tabIndicator);
		spec.setContent(contentResourceId);
		this.addTab(spec);
	}
}
